package org.yelongframework.ognl;

import org.yelongframework.core.util.map.AttrMap;

/**
 * OGNL支持的属性映射
 * 
 * @since 1.0.0
 */
public class OgnlAttrMap extends AttrMap implements Ognlable {

	private static final long serialVersionUID = -8533938366723642634L;

	/** OGNL包装器 */
	private final OgnlWrapper ognlWrapper = new OgnlWrapper();

	// ==================================================constructor==================================================

	public OgnlAttrMap() {
		ognlWrapper.setRoot(this);
	}

	// ==================================================getValue==================================================

	@Override
	public Object getValue(String expression) throws OgnlableException {
		return ognlWrapper.getValue(expression);
	}

	// ==================================================setValue==================================================

	@Override
	public void setValue(String expression, Object value) throws OgnlableException {
		ognlWrapper.setValue(expression, value);
	}

	// ==================================================getRoot==================================================

	@Override
	public Object getRoot() {
		return this;
	}

}
